// 弹出层组件
import React from 'react';
import { Button, Modal } from 'antd';
import Login from '../login/login';

class PopupLogin extends React.Component {
  state = {
    visible: false,
    width: 320,
    bodyStyle: {paddingBottom: 10}
  }
  showModal = () => {
    this.setState({
      visible: true,
    });
  }
  handleCancel = () => {
    this.setState({ visible: false });
  }
  render() {
    const { visible } = this.state;
    return (
      <div>
        <Button type="default" onClick={this.showModal}>
          登录
        </Button>
        <Modal
          visible={visible}
          width={this.state.width}
          bodyStyle={this.state.bodyStyle}
          title="登录"
          onCancel={this.handleCancel}
          footer={null}
        >
        <Login />
        </Modal>
      </div>
    );
  }
}

export default PopupLogin;
